package com.example.demo.servlet;

import com.example.demo.dao.BookDao;
import com.example.demo.entity.BookVo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Removebook extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        try {
            BookVo bookVo=new BookVo();
          String bookid = request.getParameter("bookid");
          bookVo.setBookid(Integer.valueOf(bookid));
          new BookDao().deleteBookByID(Integer.valueOf(bookid));
            request.getRequestDispatcher("/bookmanage.jsp").forward(request,response);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        }
    }
}
